package com.simpou.commons.utils.file.filter;

import java.io.File;
import java.io.FilenameFilter;

public class FileNameFilters implements FilenameFilter {

    private final FilenameFilter[] filenameFilters;

    public FileNameFilters(FilenameFilter... filenameFilter) {
        this.filenameFilters = filenameFilter;
    }
    
    @Override
    public boolean accept(File dir, String name) {
        for (FilenameFilter filenameFilter : filenameFilters) {
            boolean accepted = filenameFilter.accept(dir, name);
            if(!accepted){
                return false;
            }
        }
        return true;
    }
    
}
